import java.awt.event.*;
import javax.swing.*;

public class Practice7_2 {
	public static void main(String[] args){
		JFrame frame = new JFrame();
		frame.setSize(200,200);
		frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		
		JMenuBar menuBar = new JMenuBar();
		JMenu menu = new JMenu("Menu");
		JMenuItem menuItem = new JMenuItem("Exit");
		menuItem.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
			}
		});
		menu.add(menuItem);
		menuBar.add(menu);
        frame.setJMenuBar(menuBar); 
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setLocation(600, 300);
		frame.setVisible(true);
	}
}
